home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 September / Chip_2001-09_cd1.bin / zkuste / delphi / kompon / d23456 / TB97.ZIP / Demo (CBuilder 3) / Demo1.cpp < prev    next >
C/C++ Source or Header  |  1998-08-11  |  4KB  |  109 lines

  1. //---------------------------------------------------------------------------
  2. #include <vcl\vcl.h>
  3. #pragma hdrstop
  4.  
  5. #include <stdlib.h>
  6. #include "Demo1.h"
  7. //---------------------------------------------------------------------------
  8. #pragma resource "*.dfm"
  9. TDemoForm *DemoForm;
  10. //---------------------------------------------------------------------------
  11. __fastcall TDemoForm::TDemoForm(TComponent* Owner)
  12.         : TForm(Owner)
  13. {
  14. }
  15. //---------------------------------------------------------------------------
  16. void __fastcall TDemoForm::FormCreate(TObject *Sender)
  17. {
  18.     Memo->WordWrap = True;
  19.  
  20.     // Use the SetSlaveControl method of a TToolbar97 to configure a separate
  21.     // top/bottom docked and left/right docked version of a control.
  22.     // Please see the Toolbar97 documentation for more info on slave controls.
  23.  
  24.     // The line below tells it that FontCombo is the top/bottom docked version,
  25.     // and FontButton is the left/right docked version.
  26.     EditToolbar->SetSlaveControl (FontCombo, FontButton);
  27. }
  28. //---------------------------------------------------------------------------
  29. void __fastcall TDemoForm::FExitClick(TObject *Sender)
  30. {
  31.     Close();
  32. }
  33. //---------------------------------------------------------------------------
  34. void __fastcall TDemoForm::ToolbarPopupMenuPopup(TObject *Sender)
  35. {
  36.     TPMain->Checked = MainToolbar->Visible;
  37.     TPEdit->Checked = EditToolbar->Visible;
  38.     TPSample->Checked = SampleToolbar->Visible;
  39. }
  40. //---------------------------------------------------------------------------
  41. void __fastcall TDemoForm::VMenuClick(TObject *Sender)
  42. {
  43.     VStatusBar->Checked = StatusBar->Visible;
  44.     VTMain->Checked = MainToolbar->Visible;
  45.     VTEdit->Checked = EditToolbar->Visible;
  46.     VTSample->Checked = SampleToolbar->Visible;
  47. }
  48. //---------------------------------------------------------------------------
  49. void __fastcall TDemoForm::VTMainClick(TObject *Sender)
  50. {
  51.     MainToolbar->Visible = !MainToolbar->Visible;
  52. }
  53. //---------------------------------------------------------------------------
  54. void __fastcall TDemoForm::VTEditClick(TObject *Sender)
  55. {
  56.     EditToolbar->Visible = !EditToolbar->Visible;
  57. }
  58. //---------------------------------------------------------------------------
  59. void __fastcall TDemoForm::VTSampleClick(TObject *Sender)
  60. {
  61.     SampleToolbar->Visible = !SampleToolbar->Visible;
  62. }
  63. //---------------------------------------------------------------------------
  64. void __fastcall TDemoForm::VStatusBarClick(TObject *Sender)
  65. {
  66.     // Force the StatusBar to always be at the bottom of the form. Without this
  67.     // line of code, the status bar sometimes may appear above the bottom dock.
  68.     // This is not a bug in Toolbar97, but rather is due to the design of the
  69.     // VCL's alignment system.
  70.     StatusBar->Top = ClientHeight;
  71.  
  72.     // Toggle the status bar's visibility
  73.     StatusBar->Visible = !StatusBar->Visible;
  74. }
  75. //---------------------------------------------------------------------------
  76. void __fastcall TDemoForm::FontButtonClick(TObject *Sender)
  77. {
  78.     ShowMessage ("A font dialog could come up here.");
  79. }
  80. //---------------------------------------------------------------------------
  81. void __fastcall TDemoForm::ToolWinButtonClick(TObject *Sender)
  82. {
  83.     SampleToolWindow->Visible = ToolWinButton->Down;
  84. }
  85. //---------------------------------------------------------------------------
  86. void __fastcall TDemoForm::SampleToolWindowVisibleChanged(TObject *Sender)
  87. {
  88.     ToolWinButton->Down = SampleToolWindow->Visible;
  89. }
  90. //---------------------------------------------------------------------------
  91. void __fastcall TDemoForm::ListBoxClick(TObject *Sender)
  92. {
  93.     DeleteButton->Enabled = ListBox->ItemIndex != -1;
  94. }
  95. //---------------------------------------------------------------------------
  96. void __fastcall TDemoForm::AddButtonClick(TObject *Sender)
  97. {
  98.     ListBox->Items->Add (IntToStr(rand()));
  99. }
  100. //---------------------------------------------------------------------------
  101. void __fastcall TDemoForm::DeleteButtonClick(TObject *Sender)
  102. {
  103.     int SaveItemIndex = ListBox->ItemIndex;
  104.     ListBox->Items->Delete (ListBox->ItemIndex);
  105.     ListBox->ItemIndex = SaveItemIndex;
  106.     DeleteButton->Enabled = ListBox->ItemIndex != -1;
  107. }
  108. //---------------------------------------------------------------------------
  109.